<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>
        .el-header {
            background-color: red;
        }

        .el-main {
            background-color: white;
            height: 300px;
        }

        .el-footer {
            background-color: #e8e8e8;
        }

        .el-aside {
            background-color: #e8e8e8;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header><h1>达内后台管理系统</h1></el-header>

        <el-container>
            <el-aside width="200px">
                <div style="width: 300px;height: 1000px">
                    <el-menu>
                        <el-submenu>
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>员工管理</span>
                            </template>
                            <el-menu-item index="1-1">员工列表</el-menu-item>
                            <el-menu-item index="1-2">添加员工</el-menu-item>
                        </el-submenu>

                        <el-submenu index="2">
                            <template slot="title">
                                <i class="el-icon-edit"></i>
                                <span>部门管理</span>
                            </template>
                            <el-menu-item index="2-1">部门列表</el-menu-item>
                            <el-menu-item index="2-2">添加部门</el-menu-item>
                        </el-submenu>
                    </el-menu>
                </div>
            </el-aside>

            <el-main>
                <h3>员工列表</h3>
                <input type="text" placeholder="员工姓名" v-model="e.name">
                <input type="text" placeholder="员工工资" v-model="e.sal">
                <input type="text" placeholder="员工工作" v-model="e.job">
                <input type="button" value="添加员工" @click="add()">

                <el-table :data="arr" style="width: 100%">
                    <el-table-column type="index" label="序号"></el-table-column>
                    <el-table-column prop="name" label="姓名" width="180"></el-table-column>
                    <el-table-column prop="sal" label="工资" width="180"></el-table-column>
                    <el-table-column prop="job" label="工作" width="180"></el-table-column>

                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button
                                    size="mini"
                                    type="danger"
                                    @click="handleDelete(scope.$index, scope.row)">删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-main>
        </el-container>
    </el-container>

</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                arr: [{name: "张三", sal: 3000, job: "销售"},
                    {name: "李四", sal: 3000, job: "销售"},
                    {name: "王五", sal: 3000, job: "销售"}],
                e: {name: "", sal: "", job: ""}
            }
        },
        methods: {
            add() {
                v.arr.push({name: v.e.name, sal: v.e.sal, job: v.e.job})
            },
            handleDelete(i, e) {
                v.arr.splice(i, 1);
                v.$message(e.name + "被删除！")
            }
        }
    })
</script>
</html>